package dreamdancetiktokenumsmymongo

import "sort"

const (
	GiftObtained = 1 // 送礼物获得
	AdminReissue = 2 // 后台补发
	Give         = 3 // 赠送
	Study        = 4 // 学习
	Work         = 5 // 打工
	AutoRecovery = 6 // 自动恢复
	Upvote       = 7 // 点赞
	DelPet       = 8 // 删除宠物
)

// 宠物属性
const (
	PetMuscle = 1 // 体力值
	PetIq     = 2 // 智力值
	PetMood   = 3 // 心情值
	PetGrowth = 4 // 成长值
	PetCharm  = 5 // 魅力值
)

// 宠物流转日志类型
const (
	PetTypeDefault = 0 //获得
	PetTypeDel     = 1 //删除
)

type DancePetEnums struct{}

var DancePetEnumsObject DancePetEnums

type TmpList []int

func (it TmpList) Len() int           { return len(it) }
func (it TmpList) Less(i, j int) bool { return it[i] < it[j] }
func (it TmpList) Swap(i, j int)      { it[i], it[j] = it[j], it[i] }

func (e DancePetEnums) PetType() []int {
	list := []int{
		PetTypeDefault,
		PetTypeDel,
	}
	sort.Sort(TmpList(list))
	return list
}

func (e DancePetEnums) PetTypeMap() map[int]string {
	m := make(map[int]string)
	for _, s := range e.PetType() {
		m[s] = e.PetTypeName(s)
	}
	return m
}

func (e DancePetEnums) PetTypeName(flowAction int) string {
	switch flowAction {
	case PetTypeDefault:
		return "送礼物获得"
	case PetTypeDel:
		return "删除宠物"
	default:
		return "其他"

	}
}

func (e DancePetEnums) PetFlowAction() []int {
	list := []int{
		GiftObtained,
		AdminReissue,
		Give,
		Study,
		Work,
		AutoRecovery,
		Upvote,
		DelPet,
	}
	sort.Sort(TmpList(list))
	return list
}

func (e DancePetEnums) PetFlowActionMap() map[int]string {
	m := make(map[int]string)
	for _, s := range e.PetFlowAction() {
		m[s] = e.PetFlowActionName(s)
	}
	return m
}

func (e DancePetEnums) PetFlowActionName(flowAction int) string {
	switch flowAction {
	case GiftObtained:
		return "送礼物获得"
	case AdminReissue:
		return "后台补发"
	case Give:
		return "赠送"
	case Study:
		return "学习"
	case Work:
		return "打工"
	case AutoRecovery:
		return "自动恢复"
	case Upvote:
		return "点赞"
	case DelPet:
		return "删除宠物"
	default:
		return "其他"

	}
}

func (e DancePetEnums) PetAttribute() []int {
	return []int{
		PetMuscle,
		PetIq,
		PetMood,
		PetGrowth,
		PetCharm,
	}
}

func (e DancePetEnums) PetAttributeMap() map[int]string {
	m := make(map[int]string)
	for _, s := range e.PetAttribute() {
		m[s] = e.PetAttributeName(s)
	}
	return m
}

func (e DancePetEnums) PetAttributeName(flowAction int) string {
	switch flowAction {
	case PetMuscle:
		return "体力值"
	case PetIq:
		return "智力值"
	case PetMood:
		return "心情值"
	case PetGrowth:
		return "成长值"
	case PetCharm:
		return "魅力值"
	default:
		return "其他"

	}
}
